import time
import re
import random
import requests
from selenium.webdriver.common.by import By
from selenium import webdriver

url = 'https://pweb.bojx.com/pweb/#/login'  # 网址
driver = webdriver.Chrome()  # 调用Chrome
driver.get(url)  # 获取页面
# headers={'User-Agent:':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.82'}

# 如有弹窗需要手动关闭，之后解决
time.sleep(2)


for i in range(5):
    driver.find_element(By.XPATH, '//*[@id="app"]/div/div[2]/div[1]/div[1]/div/div[2]/form/div[5]/div/img').click()  # 模拟点击
#     imgurl = driver.find_element(By.XPATH, '//*[@id="form2_tokenImg"]').get_attribute("src")
#     m= re.search(r'(".*?")', imgurl)
#     s = str(m.group(0))
#     urll=str(r"https://pbank.zzbank.cn/pweb/prelogin.do?"+s)
#     print(i)
#     # print(r"https://ebankuat.hkbea.com.cn"+m.group(0))
#     r = requests.get(urll)
#     print(r)
#     with open('D:/yzm/'+str(urll[-6:-1])+'.jpg','wb') as f:
#         f.write(r.content)
#     time.sleep(1)
# f.close()
# driver.quit()
